<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>注册页</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
    <link rel="stylesheet" href="common.css" />
    <link rel="stylesheet" href="logIn.css" />
  </head>
  <body>
    <div class="navigation">
      <!-- 头像 -->
      <img
        src="https://img1.baidu.com/it/u=4205447136,2730860147&fm=253&fmt=auto&app=138&f=JPEG?w=300&h=300"
        alt="未登录"
      />
      <div class="title">未登录</div>
    </div>
    <!-- 登录页面 -->

    <div class="login-Container">
      <div class="dialog">
        <h3>注册</h3>

        <form action="reg" method="post" id="regForm">
          <div id="fileImage">
            <input id="i" type="button" value="请上传头像" onclick="judge();" />
            <input type="file" name="file" style="display: none" />
          </div>

          <div class="row">
            <label for="username">用户名</label>
            <input type="text" id="username" />
            <input type="submit" value="确认" onclick="conf()" />
          </div>
        </form>
        <div class="row">
          <label for="password">密码</label>
          <input type="password" id="password" />
        </div>
        <div class="r">
          <input type="submit" id="submit" value="注册" onclick="login()" />
        </div>
      </div>
    </div>

    <script>
      function conf() {
        var button = jQuery("#i");
        if (button.val() == "请上传头像") {
          alert("请上传头像！");
          button.focus();
          return;
        }
      }

      function judge() {
        var name = jQuery("#username");
        var password = jQuery("#password");

        if (name.val().trim() == "") {
          alert("请输入是谁！");
          name.focus();
          return;
        } else {
          javascript: $("input[name='file']").click();
          jQuery("#i").val("已上传");
        }
      }
    </script>
  </body>
</html>
